<!DOCTYPE html>












  


<html class="theme-next mist use-motion" lang="zh-CN">
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">


























<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2">

<link rel="stylesheet" href="/css/main.css?v=6.7.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=6.7.0">


  <link rel="icon" type="image/png" sizes="32x32" href="/uploads/favicon.ico?v=6.7.0">


  <link rel="icon" type="image/png" sizes="16x16" href="/uploads/favicon.ico?v=6.7.0">


  <link rel="mask-icon" href="/images/logo.svg?v=6.7.0" color="#222">







<script id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    version: '6.7.0',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":true,"onmobile":true},
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="How to Open, Extract and Create RAR Files in Linux&amp;emsp; RAR is a most popular tool for creating and extracting compressed archive (.rar) files. When we download an archive file from the web, we requi">
<meta name="keywords" content="rar">
<meta property="og:type" content="article">
<meta property="og:title" content="【linux】linux笔记-linux如何解压打开rar文件(转)">
<meta property="og:url" content="/2019/10/05/【linux】linux笔记-如何解压打开rar文件/index.html">
<meta property="og:site_name" content="吴楚衡">
<meta property="og:description" content="How to Open, Extract and Create RAR Files in Linux&amp;emsp; RAR is a most popular tool for creating and extracting compressed archive (.rar) files. When we download an archive file from the web, we requi">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2020-04-10T13:09:57.167Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="【linux】linux笔记-linux如何解压打开rar文件(转)">
<meta name="twitter:description" content="How to Open, Extract and Create RAR Files in Linux&amp;emsp; RAR is a most popular tool for creating and extracting compressed archive (.rar) files. When we download an archive file from the web, we requi">






  <link rel="canonical" href="/2019/10/05/【linux】linux笔记-如何解压打开rar文件/">



<script id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>【linux】linux笔记-linux如何解压打开rar文件(转) | 吴楚衡</title>
  












  <noscript>
  <style>
  .use-motion .motion-element,
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-title { opacity: initial; }

  .use-motion .logo,
  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta custom-logo">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">吴楚衡</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
      
        <h1 class="site-subtitle" itemprop="description">来找我吧！我的目标是星辰大海！</h1>
      
    
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">

    
    
    
      
    

    
      
    

    <a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">

    
    
    
      
    

    
      
    

    <a href="/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档<span class="badge">99</span></a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">

    
    
    
      
    

    
      
    

    <a href="/tags/" rel="section"><i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签<span class="badge">77</span></a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-categories">

    
    
    
      
    

    
      
    

    <a href="/categories/" rel="section"><i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类<span class="badge">17</span></a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-about">

    
    
    
      
    

    
      
    

    <a href="/about/" rel="section"><i class="menu-item-icon fa fa-fw fa-user"></i> <br>关于</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-历史">

    
    
    
      
    

    
      
    

    <a href="/history/" rel="section"><i class="menu-item-icon fa fa-fw fa-history"></i> <br>历史</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-书单">

    
    
    
      
    

    
      
    

    <a href="/book-list/index.html" rel="section"><i class="menu-item-icon fa fa-fw fa-book"></i> <br>书单</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-工具">

    
    
    
      
    

    
      
    

    <a href="/tool-list/index.html" rel="section"><i class="menu-item-icon fa fa-fw fa-book"></i> <br>工具</a>

  </li>

      
      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br>搜索</a>
        </li>
      
    </ul>
  

  
    

  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off" placeholder="搜索..." spellcheck="false" type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="/2019/10/05/【linux】linux笔记-如何解压打开rar文件/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="吴楚衡">
      <meta itemprop="description" content="IT菜鸟,写这个博客是防止未来把自己学习的东西给忘记了,也是为了自己学习的那点东西做下总结加深下印象,请多指教^_^!">
      <meta itemprop="image" content="/uploads/favicon.ico">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="吴楚衡">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">【linux】linux笔记-linux如何解压打开rar文件(转)<span class="exturl post-edit-link" data-url="aHR0cHM6Ly9naXRodWIuY29tL3d1Y2h1aGVuZy9oZXhvL3RyZWUvbWFzdGVyL3NvdXJjZS9fcG9zdHMvX3Bvc3RzL+OAkGxpbnV444CRbGludXjnrJTorrAt5aaC5L2V6Kej5Y6L5omT5byAcmFy5paH5Lu2Lm1k" title="编辑"><i class="fa fa-pencil"></i></span>

              
            
          </h2>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2019-10-05 22:28:35" itemprop="dateCreated datePublished" datetime="2019-10-05T22:28:35+08:00">2019-10-05</time>
            

            
              

              
                
                <span class="post-meta-divider">|</span>
                

                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">更新于</span>
                
                <time title="修改时间：2020-04-10 21:09:57" itemprop="dateModified" datetime="2020-04-10T21:09:57+08:00">2020-04-10</time>
              
            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/linux/" itemprop="url" rel="index"><span itemprop="name">linux</span></a></span>

                
                
              
            </span>
          

          
            
            
              
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
            
                <a href="/2019/10/05/【linux】linux笔记-如何解压打开rar文件/#comments" itemprop="discussionUrl">
                  <span class="post-meta-item-text">评论数：</span> <span class="post-comments-count valine-comment-count" data-xid="/2019/10/05/【linux】linux笔记-如何解压打开rar文件/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="post-meta-item-icon">
            <i class="fa fa-eye"></i>
             阅读次数： 
            <span class="busuanzi-value" id="busuanzi_value_page_pv"></span>
            </span>
          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h3 id="How-to-Open-Extract-and-Create-RAR-Files-in-Linux"><a href="#How-to-Open-Extract-and-Create-RAR-Files-in-Linux" class="headerlink" title="How to Open, Extract and Create RAR Files in Linux"></a>How to Open, Extract and Create RAR Files in Linux</h3><p>&emsp; RAR is a most popular tool for creating and extracting compressed archive (.rar) files. When we download an archive file from the web, we required a rar tool to extract them.<br>&emsp; RAR is available freely under Windows operating systems to handle compressed files, but unfortunately, rar tool doesn’t pre-installed under Linux systems.<br>&emsp; This article explains how to install unrar and rar command-line tools using official binary tar file under Linux systems to open, extract, uncompress or unrar an archive file.</p>
<h2 id="Step-1-How-to-Install-Unrar-in-Linux"><a href="#Step-1-How-to-Install-Unrar-in-Linux" class="headerlink" title="Step 1: How to Install Unrar in Linux"></a>Step 1: How to Install Unrar in Linux</h2><p>On Debian and Ubuntu based distributions, you can easily install unrar package using the apt-get or apt program as shown.<br><a id="more"></a><br><div class="highlight-wrap" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true" data-rel="BASH"><figure class="iseeu highlight /bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$ sudo apt-get install unrar</span><br><span class="line">Or</span><br><span class="line">$ sudo apt install unrar</span><br></pre></td></tr></table></figure></div></p>
<p>&emsp;If you are using Fedora distribution, you can use the dnf command to install it.</p>
<div class="highlight-wrap" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true" data-rel="BASH"><figure class="iseeu highlight /bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ sudp dnf install unrar</span><br></pre></td></tr></table></figure></div>
<p>&emsp;iIf you are using a CentOS / RHEL distribution, you need to download the latest unrar/rar file and install it using following commands.</p>
<div class="highlight-wrap" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true" data-rel="BASH"><figure class="iseeu highlight /bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">--------------- On 64-bit --------------- </span><br><span class="line"><span class="comment"># cd /tmp</span></span><br><span class="line"><span class="comment"># wget https://www.rarlab.com/rar/rarlinux-x64-5.6.0.tar.gz</span></span><br><span class="line"><span class="comment"># tar -zxvf rarlinux-x64-5.6.0.tar.gz</span></span><br><span class="line"><span class="comment"># cd rar</span></span><br><span class="line"><span class="comment"># sudo cp -v rar unrar /usr/local/bin/</span></span><br><span class="line"></span><br><span class="line">--------------- On 32-bit --------------- </span><br><span class="line"><span class="comment"># cd /tmp</span></span><br><span class="line"><span class="comment"># wget https://www.rarlab.com/rar/rarlinux-5.6.0.tar.gz</span></span><br><span class="line"><span class="comment"># tar -zxvf rarlinux-5.6.0.tar.gz</span></span><br><span class="line"><span class="comment"># cd rar</span></span><br><span class="line"><span class="comment"># sudo cp -v rar unrar /usr/local/bin/</span></span><br></pre></td></tr></table></figure></div>
<h2 id="Step-2-How-to-Open-Extract-a-RAR-File-in-Linux"><a href="#Step-2-How-to-Open-Extract-a-RAR-File-in-Linux" class="headerlink" title="Step 2: How to Open/Extract a RAR File in Linux"></a>Step 2: How to Open/Extract a RAR File in Linux</h2><p>&emsp; To open/extract a RAR file in current working directory, just use the following command with unrar e option.</p>
<div class="highlight-wrap" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true" data-rel="BASH"><figure class="iseeu highlight /bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># unrar e tecmint.rar</span></span><br><span class="line"></span><br><span class="line">UNRAR 4.20 beta 3 freeware      Copyright (c) 1993-2012 Alexander Roshal</span><br><span class="line"></span><br><span class="line">Extracting from tecmint.rar</span><br><span class="line"></span><br><span class="line">Extracting  index.php                                                 OK</span><br><span class="line">Extracting  index.html                                                OK</span><br><span class="line">Extracting  xyz.txt                                                   OK</span><br><span class="line">Extracting  abc.txt                                                   OK</span><br><span class="line">All OK</span><br></pre></td></tr></table></figure></div>
<p>&emsp; To open/extract a RAR file in specific path or destination directory, just use the unrar e option, it will extract all the files in specified destination directory.</p>
<div class="highlight-wrap" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true" data-rel="BASH"><figure class="iseeu highlight /bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># unrar e tecmint.rar /home/</span></span><br><span class="line"></span><br><span class="line">UNRAR 4.20 beta 3 freeware      Copyright (c) 1993-2012 Alexander Roshal</span><br><span class="line"></span><br><span class="line">Extracting from tecmint.rar</span><br><span class="line"></span><br><span class="line">Extracting  /home/index.php                                           OK</span><br><span class="line">Extracting  /home/index.html                                          OK</span><br><span class="line">Extracting  /home/xyz.txt                                             OK</span><br><span class="line">Extracting  /home/abc.txt                                             OK</span><br><span class="line">All OK</span><br></pre></td></tr></table></figure></div>
<p>To open/extract a RAR file with their original directory structure. just issue below command with unrar x option. It will extract according their folder structure see below output of the command.</p>
<div class="highlight-wrap" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true" data-rel="BASH"><figure class="iseeu highlight /bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># unrar x tecmint.rar</span></span><br><span class="line"></span><br><span class="line">UNRAR 4.20 beta 3 freeware      Copyright (c) 1993-2012 Alexander Roshal</span><br><span class="line"></span><br><span class="line">Extracting from tecmint.rar</span><br><span class="line"></span><br><span class="line">Creating    tecmint                                                   OK</span><br><span class="line">Extracting  tecmint/index.php                                         OK</span><br><span class="line">Extracting  tecmint/index.html                                        OK</span><br><span class="line">Extracting  tecmint/xyz.txt                                           OK</span><br><span class="line">Extracting  tecmint/abc.txt                                           OK</span><br><span class="line">Creating    default                                                   OK</span><br><span class="line">Extracting  default/index.php                                         OK</span><br><span class="line">Extracting  default/index.html                                        OK</span><br><span class="line">Creating    include                                                   OK</span><br><span class="line">Extracting  include/abc.txt                                           OK</span><br><span class="line">Creating    php                                                       OK</span><br><span class="line">Extracting  php/xyz.txt                                               OK</span><br><span class="line">All OK</span><br></pre></td></tr></table></figure></div>
<h2 id="Step-3-How-to-List-a-RAR-File-in-Linux"><a href="#Step-3-How-to-List-a-RAR-File-in-Linux" class="headerlink" title="Step 3: How to List a RAR File in Linux"></a>Step 3: How to List a RAR File in Linux</h2><p>To list a files inside a archive file use unrar l option. It will display the list of files with their sizes, date, time and permissions.</p>
<div class="highlight-wrap" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true" data-rel="BASH"><figure class="iseeu highlight /bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">unrar l tecmint.rar</span><br><span class="line"></span><br><span class="line">UNRAR 4.20 beta 3 freeware      Copyright (c) 1993-2012 Alexander Roshal</span><br><span class="line"></span><br><span class="line">Archive tecmint.rar</span><br><span class="line"></span><br><span class="line"> Name             Size   Packed Ratio  Date   Time     Attr      CRC   Meth Ver</span><br><span class="line"> -------------------------------------------------------------------------------</span><br><span class="line"> index.php           0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9</span><br><span class="line"> index.html          0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9</span><br><span class="line"> xyz.txt             0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9</span><br><span class="line"> abc.txt             0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9</span><br><span class="line"> index.php           0        8   0% 18-08-12 19:22 -rw-r--r-- 00000000 m3b 2.9</span><br><span class="line"> index.html          0        8   0% 18-08-12 19:22 -rw-r--r-- 00000000 m3b 2.9</span><br><span class="line"> abc.txt             0        8   0% 18-08-12 19:22 -rw-r--r-- 00000000 m3b 2.9</span><br><span class="line"> xyz.txt             0        8   0% 18-08-12 19:22 -rw-r--r-- 00000000 m3b 2.9</span><br><span class="line"> -------------------------------------------------------------------------------</span><br><span class="line"> 8                0       64   0%</span><br></pre></td></tr></table></figure></div>
<h2 id="Step-4-How-to-Test-a-RAR-File-in-Linux"><a href="#Step-4-How-to-Test-a-RAR-File-in-Linux" class="headerlink" title="Step 4: How to Test a RAR File in Linux"></a>Step 4: How to Test a RAR File in Linux</h2><p>To test an integrity of a archive file, use option unrar t. The below command will perform a complete integrity check for each file and displays the status of the file.</p>
<div class="highlight-wrap" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true" data-rel="BASH"><figure class="iseeu highlight /bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">unrar t tecmint.rar</span><br><span class="line"></span><br><span class="line">UNRAR 4.20 beta 3 freeware      Copyright (c) 1993-2012 Alexander Roshal</span><br><span class="line"></span><br><span class="line">Testing archive tecmint.rar</span><br><span class="line"></span><br><span class="line">Testing     tecmint/index.php                                         OK</span><br><span class="line">Testing     tecmint/index.html                                        OK</span><br><span class="line">Testing     tecmint/xyz.txt                                           OK</span><br><span class="line">Testing     tecmint/abc.txt                                           OK</span><br><span class="line">Testing     default/index.php                                         OK</span><br><span class="line">Testing     default/index.html                                        OK</span><br><span class="line">Testing     include/abc.txt                                           OK</span><br><span class="line">Testing     php/xyz.txt                                               OK</span><br><span class="line">All OK</span><br></pre></td></tr></table></figure></div>
<p>The unrar command is used to extract, list or test archive files only. It has no any option for creating RAR files under Linux. So, here we need to install RAR command-line utility to create archive files.</p>
<h2 id="Step-5-How-to-Install-Rar-in-Linux"><a href="#Step-5-How-to-Install-Rar-in-Linux" class="headerlink" title="Step 5: How to Install Rar in Linux"></a>Step 5: How to Install Rar in Linux</h2><p>To install RAR command option in Linux, just execute following command.<br><div class="highlight-wrap" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true" data-rel="BASH"><figure class="iseeu highlight /bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># sudo apt-get install rar</span></span><br><span class="line"><span class="comment"># sudo dnf install rar</span></span><br><span class="line"><span class="comment"># yum install rar</span></span><br></pre></td></tr></table></figure></div></p>
<h2 id="Sample-Output"><a href="#Sample-Output" class="headerlink" title="Sample Output"></a>Sample Output</h2><div class="highlight-wrap" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true" data-rel="BASH"><figure class="iseeu highlight /bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line">Loaded plugins: fastestmirror</span><br><span class="line">Loading mirror speeds from cached hostfile</span><br><span class="line">Dependencies Resolved</span><br><span class="line">=========================================================================================</span><br><span class="line">Package            Arch            Version             Repository          Size</span><br><span class="line">=========================================================================================</span><br><span class="line">Installing:</span><br><span class="line">rar               i386            3.8.0-1.el5.rf      rpmforge            264 k</span><br><span class="line"></span><br><span class="line">Transaction Summary</span><br><span class="line">    =========================================================================================</span><br><span class="line">    Install       1 Package(s)</span><br><span class="line">Upgrade       0 Package(s)</span><br><span class="line"></span><br><span class="line">Total download size: 264 k</span><br><span class="line">Is this ok [y/N]: y</span><br><span class="line">Downloading Packages:</span><br><span class="line">rar-3.8.0-1.el5.rf.i386.rpm                                       | 264 kB     00:01</span><br><span class="line">Running rpm_check_debug</span><br><span class="line">Running Transaction Test</span><br><span class="line">Finished Transaction Test</span><br><span class="line">Transaction Test Succeeded</span><br><span class="line">Running Transaction</span><br><span class="line">Installing     : rar                                          1/1</span><br><span class="line"></span><br><span class="line">Installed:</span><br><span class="line">rar.i386 0:3.8.0-1.el5.rf</span><br><span class="line"></span><br><span class="line">Complete!</span><br></pre></td></tr></table></figure></div>
<h2 id="Step-6-How-to-Create-Rar-File-in-Linux"><a href="#Step-6-How-to-Create-Rar-File-in-Linux" class="headerlink" title="Step 6: How to Create Rar File in Linux"></a>Step 6: How to Create Rar File in Linux</h2><p>To create a archive(RAR) file in Linux, run the following command with rar a option. It will create archive file for a tecmint directory.</p>
<div class="highlight-wrap" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true" data-rel="BASH"><figure class="iseeu highlight /bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">rar a tecmint.rar tecmint</span><br><span class="line"></span><br><span class="line">RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008</span><br><span class="line">Shareware version         Type RAR -? <span class="keyword">for</span> <span class="built_in">help</span></span><br><span class="line"></span><br><span class="line">Evaluation copy. Please register.</span><br><span class="line"></span><br><span class="line">Creating archive tecmint.rar</span><br><span class="line"></span><br><span class="line">Adding    tecmint/index.php                                           OK</span><br><span class="line">Adding    tecmint/index.html                                          OK</span><br><span class="line">Adding    tecmint/xyz.txt                                             OK</span><br><span class="line">Adding    tecmint/abc.txt                                             OK</span><br><span class="line">Adding    tecmint                                                     OK</span><br><span class="line">Done</span><br></pre></td></tr></table></figure></div>
<h2 id="Step-7-How-to-Delete-files-from-Archive"><a href="#Step-7-How-to-Delete-files-from-Archive" class="headerlink" title="Step 7: How to Delete files from Archive"></a>Step 7: How to Delete files from Archive</h2><div class="highlight-wrap" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true" data-rel="BASH"><figure class="iseeu highlight /bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">rar d filename.rar</span><br></pre></td></tr></table></figure></div>
<h2 id="Step-8-How-to-Recover-Archives"><a href="#Step-8-How-to-Recover-Archives" class="headerlink" title="Step 8: How to Recover Archives"></a>Step 8: How to Recover Archives</h2><p>To recover or fix a archive file or files, run the command with option rar r.</p>
<div class="highlight-wrap" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true" data-rel="BASH"><figure class="iseeu highlight /bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">rar r filename.rar</span><br><span class="line"></span><br><span class="line">RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008</span><br><span class="line">Shareware version         Type RAR -? <span class="keyword">for</span> <span class="built_in">help</span></span><br><span class="line"></span><br><span class="line">Building fixed.tecmint.rar</span><br><span class="line">Scanning...</span><br><span class="line">Data recovery record not found</span><br><span class="line">Reconstructing tecmint.rar</span><br><span class="line">Building rebuilt.tecmint.rar</span><br><span class="line">Found  tecmint\index.php</span><br><span class="line">Found  tecmint\index.html</span><br><span class="line">Found  tecmint\xyz.txt</span><br><span class="line">Found  tecmint\abc.txt</span><br><span class="line">Found  tecmint</span><br><span class="line">Done</span><br></pre></td></tr></table></figure></div>
<p>Step 9: How to Update Archives</p>
<hr>
<p>To update or add files to existing archive file, use the following command with option rar u.<br><div class="highlight-wrap" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true" data-rel="BASH"><figure class="iseeu highlight /bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">rar u tecmint.rar tecmint.sql</span><br><span class="line"></span><br><span class="line">RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008</span><br><span class="line">Shareware version         Type RAR -? <span class="keyword">for</span> <span class="built_in">help</span></span><br><span class="line"></span><br><span class="line">Evaluation copy. Please register.</span><br><span class="line"></span><br><span class="line">Updating archive tecmint.rar</span><br><span class="line"></span><br><span class="line">Adding    tecmint.sql                                                 OK</span><br><span class="line">Done</span><br></pre></td></tr></table></figure></div></p>
<p>Now, verify that the file tecmint.sql is added to archive file.</p>
<div class="highlight-wrap" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true" data-rel="BASH"><figure class="iseeu highlight /bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">rar l tecmint.rar</span><br><span class="line"></span><br><span class="line">RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008</span><br><span class="line">Shareware version         Type RAR -? <span class="keyword">for</span> <span class="built_in">help</span></span><br><span class="line"></span><br><span class="line">Archive tecmint.rar</span><br><span class="line"></span><br><span class="line"> Name             Size   Packed Ratio  Date   Time     Attr      CRC   Meth Ver</span><br><span class="line"> -------------------------------------------------------------------------------</span><br><span class="line"> index.php           0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9</span><br><span class="line"> index.html          0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9</span><br><span class="line"> xyz.txt             0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9</span><br><span class="line"> abc.txt             0        8   0% 18-08-12 19:11 -rw-r--r-- 00000000 m3b 2.9</span><br><span class="line"> tecmint             0        0   0% 18-08-12 19:23 drwxr-xr-x 00000000 m0  2.0</span><br><span class="line"> tecmint.sql 0 8 0% 18-08-12 19:46 -rw-r--r-- 00000000 m3b 2.9</span><br><span class="line"> -------------------------------------------------------------------------------</span><br><span class="line"> 6                0       40   0%</span><br></pre></td></tr></table></figure></div>
<h2 id="Step-10-How-to-Set-Password-to-Archives"><a href="#Step-10-How-to-Set-Password-to-Archives" class="headerlink" title="Step 10: How to Set Password to Archives"></a>Step 10: How to Set Password to Archives</h2><div class="highlight-wrap" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true" data-rel="BASH"><figure class="iseeu highlight /bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">rar a -p tecmint.rar</span><br><span class="line"></span><br><span class="line">Enter password (will not be echoed):</span><br><span class="line"></span><br><span class="line">Reenter password:</span><br><span class="line"></span><br><span class="line">AR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008</span><br><span class="line">Shareware version         Type RAR -? <span class="keyword">for</span> <span class="built_in">help</span></span><br><span class="line"></span><br><span class="line">Evaluation copy. Please register.</span><br><span class="line"></span><br><span class="line">Updating archive tecmint.rar</span><br><span class="line"></span><br><span class="line">Updating  tecmint.sql                                                 OK</span><br><span class="line">Done</span><br></pre></td></tr></table></figure></div>
<p>Now verify it by extracting the archive file and see whether it will prompt us to enter password that we have set above.</p>
<div class="highlight-wrap" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true" data-rel="BASH"><figure class="iseeu highlight /bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">rar x tecmint.rar</span><br><span class="line"></span><br><span class="line">RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008</span><br><span class="line">Shareware version         Type RAR -? <span class="keyword">for</span> <span class="built_in">help</span></span><br><span class="line"></span><br><span class="line">Extracting from tecmint.rar</span><br><span class="line"></span><br><span class="line">Creating    tecmint                                                   OK</span><br><span class="line">Extracting  tecmint/index.php                                         OK</span><br><span class="line">Extracting  tecmint/index.html                                        OK</span><br><span class="line">Extracting  tecmint/xyz.txt                                           OK</span><br><span class="line">Extracting  tecmint/abc.txt                                           OK</span><br><span class="line">Enter password (will not be echoed) <span class="keyword">for</span> tecmint.sql:</span><br><span class="line"></span><br><span class="line">Extracting  tecmint.sql                                               OK</span><br><span class="line">All OK</span><br></pre></td></tr></table></figure></div>
<h2 id="Step-11-How-to-Lock-Archives"><a href="#Step-11-How-to-Lock-Archives" class="headerlink" title="Step 11: How to Lock Archives"></a>Step 11: How to Lock Archives</h2><p>Another interesting lock feature from rar tool, it provides a option to lock a particular archive file from extracting it.</p>
<div class="highlight-wrap" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true" data-rel="BASH"><figure class="iseeu highlight /bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">rar k tecmint.rar</span><br><span class="line"></span><br><span class="line">RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008</span><br><span class="line">Shareware version         Type RAR -? <span class="keyword">for</span> <span class="built_in">help</span></span><br><span class="line"></span><br><span class="line">Processing archive tecmint.rar</span><br><span class="line">Locking archive</span><br><span class="line">Done</span><br></pre></td></tr></table></figure></div>
<h2 id="Conclusion"><a href="#Conclusion" class="headerlink" title="Conclusion"></a>Conclusion</h2><p>For mor RAR and Unrar options and usage, run the following command it will display a list of options with their description.</p>
<div class="highlight-wrap" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" contenteditable="true" data-rel="BASH"><figure class="iseeu highlight /bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># man unrar</span></span><br><span class="line"><span class="comment"># man rar</span></span><br></pre></td></tr></table></figure></div>
<p>We have presented almost all of the options above for rar and unrar commands with their examples. If you feel that we’ve missed anything in this list and you would like us to add, please update us using comment form below.</p>
<p>Sharing is Caring…</p>
<p><span class="exturl" data-url="aHR0cHM6Ly93d3cudGVjbWludC5jb20vaG93LXRvLW9wZW4tZXh0cmFjdC1hbmQtY3JlYXRlLXJhci1maWxlcy1pbi1saW51eC8=" title="https://www.tecmint.com/how-to-open-extract-and-create-rar-files-in-linux/">文章来源<i class="fa fa-external-link"></i></span></p>

      
    </div>

    

    
    
    

    

    
      
    
    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div>坚持原创技术分享，您的支持将鼓励我继续创作！</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>打赏</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="/uploads/pay/wechatpay.png" alt="吴楚衡 微信支付">
        <p>微信支付</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/uploads/pay/alipay.png" alt="吴楚衡 支付宝">
        <p>支付宝</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/rar/" rel="tag"># rar</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2019/10/03/【mysql】phpmyadmin学习笔记-配置/" rel="next" title="【mysql】phpmyadmin学习笔记-配置">
                <i class="fa fa-chevron-left"></i> 【mysql】phpmyadmin学习笔记-配置
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2019/10/09/【php】php笔记-RSA加密解密/" rel="prev" title="【php】php笔记-RSA加密解密(转)">
                【php】php笔记-RSA加密解密(转) <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  
    <div class="comments" id="comments">
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
      <div id="sidebar-dimmer"></div>
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/uploads/favicon.ico" alt="吴楚衡">
            
              <p class="site-author-name" itemprop="name">吴楚衡</p>
              <p class="site-description motion-element" itemprop="description">IT菜鸟,写这个博客是防止未来把自己学习的东西给忘记了,也是为了自己学习的那点东西做下总结加深下印象,请多指教^_^!</p>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">99</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  <a href="/categories/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">16</span>
                    <span class="site-state-item-name">分类</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  <a href="/tags/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">76</span>
                    <span class="site-state-item-name">标签</span>
                  </a>
                </div>
              
            </nav>
          

          

          
            <div class="links-of-author motion-element">
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <span class="exturl" data-url="aHR0cHM6Ly9naXRodWIuY29tL3d1Y2h1aGVuZw==" title="GitHub &rarr; https://github.com/wuchuheng"><i class="fa fa-fw fa-github"></i>GitHub</span>
                </span>
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <span class="exturl" data-url="bWFpbHRvOmFkbWluQHd1Y2h1aGVuZy5jb20=" title="E-Mail &rarr; mailto:admin@wuchuheng.com"><i class="fa fa-fw fa-envelope"></i>E-Mail</span>
                </span>
              
            </div>
          

          

          
          
            <div class="links-of-blogroll motion-element links-of-blogroll-block">
              <div class="links-of-blogroll-title">
                <i class="fa  fa-fw fa-link"></i>
                Links
              </div>
              <ul class="links-of-blogroll-list">
                
                  <li class="links-of-blogroll-item">
                    <span class="exturl" data-url="aHR0cHM6Ly9oZXhvLmlvL3poLWNuL2RvY3MvaW5kZXguaHRtbA==" title="https://hexo.io/zh-cn/docs/index.html">hexo文档</span>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <span class="exturl" data-url="aHR0cDovL3RoZW1lLW5leHQuaWlzc25hbi5jb20=" title="http://theme-next.iissnan.com">主题文档</span>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <span class="exturl" data-url="aHR0cDovL3d3dy5saW51eGV5ZS5jb20=" title="http://www.linuxeye.com">linux学习平台</span>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <span class="exturl" data-url="aHR0cHM6Ly9naXQtc2NtLmNvbS9ib29rL3poL3Yy" title="https://git-scm.com/book/zh/v2">git使用手册</span>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <span class="exturl" data-url="aHR0cHM6Ly9oaWdobGlnaHRqcy5vcmc=" title="https://highlightjs.org">highlightjs</span>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <span class="exturl" data-url="aHR0cHM6Ly9odWIuZG9ja2VyLmNvbS91L3d1Y2h1aGVuZy8=" title="https://hub.docker.com/u/wuchuheng/">docker</span>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <span class="exturl" data-url="aHR0cDovL3hpYW9oYW55dS5tZQ==" title="http://xiaohanyu.me">cnlox</span>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <span class="exturl" data-url="aHR0cDovL3hpYW9oYW55dS5tZQ==" title="http://xiaohanyu.me">vim从入门到精通</span>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <span class="exturl" data-url="aHR0cHM6Ly9jaWtlYmxvZy5jb20v" title="https://cikeblog.com/">刺客博客</span>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <span class="exturl" data-url="aHR0cHM6Ly9oeWRpbmdzeS5naXRodWIuaW8v" title="https://hydingsy.github.io/">算法牛人</span>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <span class="exturl" data-url="aHR0cDovL3hhcmdpbi5jb20vcmVhZGluZ3Mv" title="http://xargin.com/readings/">牛人</span>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <span class="exturl" data-url="aHR0cHM6Ly9lYm9va2ZvdW5kYXRpb24uZ2l0aHViLmlvL2ZyZWUtcHJvZ3JhbW1pbmctYm9va3Mv" title="https://ebookfoundation.github.io/free-programming-books/">githhub开源书</span>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <span class="exturl" data-url="aHR0cHM6Ly9sYWlqdy5jb20v" title="https://laijw.com/">赖经纬</span>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <span class="exturl" data-url="aHR0cHM6Ly93dzRrLmNvbS8=" title="https://ww4k.com/">徐庆业</span>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <span class="exturl" data-url="aHR0cHM6Ly9oYXNhaWsuY29tLw==" title="https://hasaik.com/">next主题参考</span>
                  </li>
                
              </ul>
            </div>
          

          
            
          
          

        </div>
      </div>

      
      <!--noindex-->
        <div class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
            
            
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#How-to-Open-Extract-and-Create-RAR-Files-in-Linux"><span class="nav-text">How to Open, Extract and Create RAR Files in Linux</span></a></li></ol><li class="nav-item nav-level-2"><a class="nav-link" href="#Step-1-How-to-Install-Unrar-in-Linux"><span class="nav-text">Step 1: How to Install Unrar in Linux</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Step-2-How-to-Open-Extract-a-RAR-File-in-Linux"><span class="nav-text">Step 2: How to Open/Extract a RAR File in Linux</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Step-3-How-to-List-a-RAR-File-in-Linux"><span class="nav-text">Step 3: How to List a RAR File in Linux</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Step-4-How-to-Test-a-RAR-File-in-Linux"><span class="nav-text">Step 4: How to Test a RAR File in Linux</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Step-5-How-to-Install-Rar-in-Linux"><span class="nav-text">Step 5: How to Install Rar in Linux</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Sample-Output"><span class="nav-text">Sample Output</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Step-6-How-to-Create-Rar-File-in-Linux"><span class="nav-text">Step 6: How to Create Rar File in Linux</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Step-7-How-to-Delete-files-from-Archive"><span class="nav-text">Step 7: How to Delete files from Archive</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Step-8-How-to-Recover-Archives"><span class="nav-text">Step 8: How to Recover Archives</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Step-10-How-to-Set-Password-to-Archives"><span class="nav-text">Step 10: How to Set Password to Archives</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Step-11-How-to-Lock-Archives"><span class="nav-text">Step 11: How to Lock Archives</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Conclusion"><span class="nav-text">Conclusion</span></a></li></div>
            

          </div>
        </div>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">  <span class="exturl" data-url="aHR0cDovL3d3dy5taWl0YmVpYW4uZ292LmNu">粤ICP备17071471号 </span>&copy; <span itemprop="copyrightYear">2020</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">吴楚衡</span>

  

  
</div>


  <div class="powered-by">由 <span class="exturl theme-link" data-url="aHR0cHM6Ly9oZXhvLmlv">Hexo</span> 强力驱动 v3.9.0</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 – <span class="exturl theme-link" data-url="aHR0cHM6Ly90aGVtZS1uZXh0Lm9yZw==">NexT.Mist</span> v6.7.0</div>





  <script src="https://unpkg.com/mermaid@7.1.2/dist/mermaid.min.js"></script>
    <script>
        if (window.mermaid) {
            mermaid.initialize("");
        }
  </script>



        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="post-meta-item-icon">
      <i class="fa fa-user"></i>
    </span>
    <span class="site-uv" title="总访客量">
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
    </span>
  

  
    <span class="post-meta-divider">|</span>
  

  
    <span class="post-meta-item-icon">
      <i class="fa fa-eye"></i>
    </span>
    <span class="site-pv" title="总访问量">
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
    </span>
  
</div>









        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
          <span id="scrollpercent"><span>0</span>%</span>
        
      </div>
    

    

    

    
  </div>

  

<script>
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>


























  
  <script src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>


  


  <script src="/js/src/utils.js?v=6.7.0"></script>

  <script src="/js/src/motion.js?v=6.7.0"></script>



  
  


  <script src="/js/src/schemes/muse.js?v=6.7.0"></script>




  
  <script src="/js/src/scrollspy.js?v=6.7.0"></script>
<script src="/js/src/post-details.js?v=6.7.0"></script>



  


  <script src="/js/src/bootstrap.js?v=6.7.0"></script>



  
  

<script src="//cdn1.lncld.net/static/js/3.11.1/av-min.js"></script>



<script src="//unpkg.com/valine/dist/Valine.min.js"></script>

<script>
  var GUEST = ['nick', 'mail', 'link'];
  var guest = 'nick,mail,link';
  guest = guest.split(',').filter(function(item) {
    return GUEST.indexOf(item) > -1;
  });
  new Valine({
    el: '#comments',
    verify: false,
    notify: false,
    appId: 'vUPCRqeu7bXvUdFGGLuT3zvs-gzGzoHsz',
    appKey: 'cooQBOkOaV3XE3SP4ihtaWOe',
    placeholder: 'Just go go',
    avatar: 'mm',
    meta: guest,
    pageSize: '10' || 10,
    visitor: false
  });
</script>




  


  

  <script>
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url).replace(/\/{2,}/g, '/');
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x"></i></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x"></i></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





  

  

  

  

  

  

  

  

  

  
  <script src="/js/src/exturl.js?v=6.7.0"></script>


  

  
  <style>
    .copy-btn {
      display: inline-block;
      padding: 6px 12px;
      font-size: 13px;
      font-weight: 700;
      line-height: 20px;
      color: #333;
      white-space: nowrap;
      vertical-align: middle;
      cursor: pointer;
      background-color: #eee;
      background-image: linear-gradient(#fcfcfc, #eee);
      border: 1px solid #d5d5d5;
      border-radius: 3px;
      user-select: none;
      outline: 0;
    }

    .highlight-wrap .copy-btn {
      transition: opacity .3s ease-in-out;
      opacity: 0;
      padding: 2px 6px;
      position: absolute;
      right: 4px;
      top: 8px;
    }

    .highlight-wrap:hover .copy-btn,
    .highlight-wrap .copy-btn:focus {
      opacity: 1
    }

    .highlight-wrap {
      position: relative;
    }
  </style>
  <script>
    $('.highlight').each(function(i, e) {
      var $wrap = $('<div>').addClass('highlight-wrap');
      $(e).after($wrap);
      $wrap.append($('<button>').addClass('copy-btn').append('复制').on('click', function(e) {
        var code = $(this).parent().find('.code').find('.line').map(function(i, e) {
          return $(e).text();
        }).toArray().join('\n');
        var ta = document.createElement('textarea');
        var range = document.createRange(); //For Chrome
        var sel = window.getSelection(); //For Chrome
        var yPosition = window.pageYOffset || document.documentElement.scrollTop;
        ta.style.top = yPosition + 'px'; //Prevent page scroll
        ta.style.position = 'absolute';
        ta.style.opacity = '0';
        ta.value = code;
        ta.textContent = code; //For FireFox
        ta.contentEditable = true;
        ta.readOnly = false;
        document.body.appendChild(ta);
        range.selectNode(ta);
        sel.removeAllRanges();
        sel.addRange(range);
        ta.setSelectionRange(0, code.length);
        var result = document.execCommand('copy');
        
          if (result) $(this).text('复制成功');
          else $(this).text('复制失败');
        
        ta.blur(); //For iOS
        $(this).blur();
      })).on('mouseleave', function(e) {
        var $b = $(this).find('.copy-btn');
        setTimeout(function() {
          $b.text('复制');
        }, 300);
      }).append(e);
    })
  </script>


  

</body>
</html>
